package com.opNaga.bpmp.basicTest;

import com.opNaga.bpmp.artifact.Annotation;
import com.opNaga.bpmp.artifact.DataObject;
import com.opNaga.bpmp.artifact.Group;
import com.opNaga.bpmp.connectingObject.association.AssociationFlowSource;
import com.opNaga.bpmp.connectingObject.association.AssociationFlowTarget;
import com.opNaga.bpmp.connectingObject.messageFlow.MessageFlowSource;
import com.opNaga.bpmp.connectingObject.messageFlow.MessageFlowTarget;
import com.opNaga.bpmp.connectingObject.sequenceFlow.SequenceFlowSource;
import com.opNaga.bpmp.connectingObject.sequenceFlow.SequenceFlowTarget;
import com.opNaga.bpmp.flowObject.activity.SubProcess;
import com.opNaga.bpmp.flowObject.activity.Task;
import com.opNaga.bpmp.flowObject.event.EndEvent;
import com.opNaga.bpmp.flowObject.event.IntermediateEvent;
import com.opNaga.bpmp.flowObject.event.StartEvent;
import com.opNaga.bpmp.flowObject.gateway.ANDGateway;
import com.opNaga.bpmp.flowObject.gateway.ORGateway;
import com.opNaga.bpmp.flowObject.gateway.XORGateway;
import com.opNaga.bpmp.swimlane.Lane;
import com.opNaga.bpmp.swimlane.Pool;
import org.junit.Assert;
import org.junit.Test;

/**
 * User: Junyi BEI
 * Date: 30/01/2012
 * Time: 13:21
 */
public class ConnectingObjectAssignables {
  @Test
  public void sequenceFlowTargets() {
    Assert.assertFalse(SequenceFlowTarget.class.isAssignableFrom(Pool.class));
    Assert.assertFalse(SequenceFlowTarget.class.isAssignableFrom(Lane.class));
    Assert.assertTrue(SequenceFlowTarget.class.isAssignableFrom(ANDGateway.class));
    Assert.assertTrue(SequenceFlowTarget.class.isAssignableFrom(ORGateway.class));
    Assert.assertTrue(SequenceFlowTarget.class.isAssignableFrom(XORGateway.class));
    Assert.assertFalse(SequenceFlowTarget.class.isAssignableFrom(StartEvent.class));
    Assert.assertTrue(SequenceFlowTarget.class.isAssignableFrom(IntermediateEvent.class));
    Assert.assertTrue(SequenceFlowTarget.class.isAssignableFrom(EndEvent.class));
    Assert.assertTrue(SequenceFlowTarget.class.isAssignableFrom(SubProcess.class));
    Assert.assertTrue(SequenceFlowTarget.class.isAssignableFrom(Task.class));
    Assert.assertFalse(SequenceFlowTarget.class.isAssignableFrom(Annotation.class));
    Assert.assertFalse(SequenceFlowTarget.class.isAssignableFrom(Group.class));
    Assert.assertFalse(SequenceFlowTarget.class.isAssignableFrom(DataObject.class));
  }

  @Test
  public void sequenceFlowSources() {
    Assert.assertFalse(SequenceFlowSource.class.isAssignableFrom(Pool.class));
    Assert.assertFalse(SequenceFlowSource.class.isAssignableFrom(Lane.class));
    Assert.assertTrue(SequenceFlowSource.class.isAssignableFrom(ANDGateway.class));
    Assert.assertTrue(SequenceFlowSource.class.isAssignableFrom(ORGateway.class));
    Assert.assertTrue(SequenceFlowSource.class.isAssignableFrom(XORGateway.class));
    Assert.assertTrue(SequenceFlowSource.class.isAssignableFrom(StartEvent.class));
    Assert.assertTrue(SequenceFlowSource.class.isAssignableFrom(IntermediateEvent.class));
    Assert.assertFalse(SequenceFlowSource.class.isAssignableFrom(EndEvent.class));
    Assert.assertTrue(SequenceFlowSource.class.isAssignableFrom(SubProcess.class));
    Assert.assertTrue(SequenceFlowSource.class.isAssignableFrom(Task.class));
    Assert.assertFalse(SequenceFlowSource.class.isAssignableFrom(Annotation.class));
    Assert.assertFalse(SequenceFlowSource.class.isAssignableFrom(Group.class));
    Assert.assertFalse(SequenceFlowSource.class.isAssignableFrom(DataObject.class));
  }

  @Test
  public void messageFlowTargets() {
    Assert.assertTrue(MessageFlowTarget.class.isAssignableFrom(Pool.class));
    Assert.assertFalse(MessageFlowTarget.class.isAssignableFrom(Lane.class));
    Assert.assertFalse(MessageFlowTarget.class.isAssignableFrom(ANDGateway.class));
    Assert.assertFalse(MessageFlowTarget.class.isAssignableFrom(ORGateway.class));
    Assert.assertFalse(MessageFlowTarget.class.isAssignableFrom(XORGateway.class));
    Assert.assertTrue(MessageFlowTarget.class.isAssignableFrom(StartEvent.class));
    Assert.assertTrue(MessageFlowTarget.class.isAssignableFrom(IntermediateEvent.class));
    Assert.assertFalse(MessageFlowTarget.class.isAssignableFrom(EndEvent.class));
    Assert.assertTrue(MessageFlowTarget.class.isAssignableFrom(SubProcess.class));
    Assert.assertTrue(MessageFlowTarget.class.isAssignableFrom(Task.class));
    Assert.assertFalse(MessageFlowTarget.class.isAssignableFrom(Annotation.class));
    Assert.assertFalse(MessageFlowTarget.class.isAssignableFrom(Group.class));
    Assert.assertFalse(MessageFlowTarget.class.isAssignableFrom(DataObject.class));
  }

  @Test
  public void messageFlowSources() {
    Assert.assertTrue(MessageFlowSource.class.isAssignableFrom(Pool.class));
    Assert.assertFalse(MessageFlowSource.class.isAssignableFrom(Lane.class));
    Assert.assertFalse(MessageFlowSource.class.isAssignableFrom(ANDGateway.class));
    Assert.assertFalse(MessageFlowSource.class.isAssignableFrom(ORGateway.class));
    Assert.assertFalse(MessageFlowSource.class.isAssignableFrom(XORGateway.class));
    Assert.assertFalse(MessageFlowSource.class.isAssignableFrom(StartEvent.class));
    Assert.assertFalse(MessageFlowSource.class.isAssignableFrom(IntermediateEvent.class));
    Assert.assertTrue(MessageFlowSource.class.isAssignableFrom(EndEvent.class));
    Assert.assertTrue(MessageFlowSource.class.isAssignableFrom(SubProcess.class));
    Assert.assertTrue(MessageFlowSource.class.isAssignableFrom(Task.class));
    Assert.assertFalse(MessageFlowSource.class.isAssignableFrom(Annotation.class));
    Assert.assertFalse(MessageFlowSource.class.isAssignableFrom(Group.class));
    Assert.assertFalse(MessageFlowSource.class.isAssignableFrom(DataObject.class));
  }

  @Test
  public void associationTargets() {
    Assert.assertTrue(AssociationFlowTarget.class.isAssignableFrom(Pool.class));
    Assert.assertFalse(AssociationFlowTarget.class.isAssignableFrom(Lane.class));
    Assert.assertTrue(AssociationFlowTarget.class.isAssignableFrom(ANDGateway.class));
    Assert.assertTrue(AssociationFlowTarget.class.isAssignableFrom(ORGateway.class));
    Assert.assertTrue(AssociationFlowTarget.class.isAssignableFrom(XORGateway.class));
    Assert.assertTrue(AssociationFlowTarget.class.isAssignableFrom(StartEvent.class));
    Assert.assertTrue(AssociationFlowTarget.class.isAssignableFrom(IntermediateEvent.class));
    Assert.assertTrue(AssociationFlowTarget.class.isAssignableFrom(EndEvent.class));
    Assert.assertTrue(AssociationFlowTarget.class.isAssignableFrom(SubProcess.class));
    Assert.assertTrue(AssociationFlowTarget.class.isAssignableFrom(Task.class));
    Assert.assertTrue(AssociationFlowTarget.class.isAssignableFrom(Annotation.class));
    Assert.assertTrue(AssociationFlowTarget.class.isAssignableFrom(Group.class));
    Assert.assertTrue(AssociationFlowTarget.class.isAssignableFrom(DataObject.class));
  }

  @Test
  public void associationSources() {
    Assert.assertTrue(AssociationFlowSource.class.isAssignableFrom(Pool.class));
    Assert.assertFalse(AssociationFlowSource.class.isAssignableFrom(Lane.class));
    Assert.assertTrue(AssociationFlowSource.class.isAssignableFrom(ANDGateway.class));
    Assert.assertTrue(AssociationFlowSource.class.isAssignableFrom(ORGateway.class));
    Assert.assertTrue(AssociationFlowSource.class.isAssignableFrom(XORGateway.class));
    Assert.assertTrue(AssociationFlowSource.class.isAssignableFrom(StartEvent.class));
    Assert.assertTrue(AssociationFlowSource.class.isAssignableFrom(IntermediateEvent.class));
    Assert.assertTrue(AssociationFlowSource.class.isAssignableFrom(EndEvent.class));
    Assert.assertTrue(AssociationFlowSource.class.isAssignableFrom(SubProcess.class));
    Assert.assertTrue(AssociationFlowSource.class.isAssignableFrom(Task.class));
    Assert.assertTrue(AssociationFlowSource.class.isAssignableFrom(Annotation.class));
    Assert.assertTrue(AssociationFlowSource.class.isAssignableFrom(Group.class));
    Assert.assertTrue(AssociationFlowSource.class.isAssignableFrom(DataObject.class));
  }
}
